<template>
	<div>
		<a-table class='mt28'  :columns="columns" :data-source="List"  :row-key="record => record.code">
			<span slot='gender' slot-scope='text'>{{text | gender}}</span>
	    	<span slot='createTime' slot-scope='text,record'>{{text | formatDate}}</span>
		    <span slot="action" slot-scope="text, record">
		      <router-link  :to='{ path:"/customerDetail",query:{code:record.code} }'  class='color-blue'>查看用户详情</router-link> 
		       
		    </span>
	  	</a-table>
	</div>
</template>		

<script type="text/javascript">
	const columns = 
	[
	  {
	  	title:'用户名',
	    dataIndex: 'name',
	    key: 'name'
	  },
	  {
	  	title:'账号/手机号',
	  	dataIndex:'mobile',
	  	key:'mobile'
	  },
	  {
	  	title:'性别',
	  	dataIndex:'gender',
	  	key:'gender',
	  	scopedSlots: { customRender: 'gender' }
	  },
	  {
	  	title:'注册时间',
	  	dataIndex:'createTime',
	  	key:'createTime', 
    	scopedSlots: { customRender: 'createTime' }
	  },
	  {
	  	title:'操作',
	  	dataIndex:'action',
	  	key:'action', 
    	scopedSlots: { customRender: 'action' }
	  }

	]
	import { listCustomer } from '@/api/minipro/customer'
	export default{
		name:'customer',
		data(){
			return {
				columns,
				search:{
					pageNo:1,
					pageSize:10
				},
				List:[]
			}
		},
		created(){
			this.pageInit()
		},
		methods:{
			pageInit(){
				listCustomer(this.search).then((res)=>{
					this.List = res.data.dataList
				})
			}
		}
	}
</script>